Fix: Use auxiliary entity (reg view camera) for gpu visibility range culling if defined#24133
Fix: Use auxiliary entity (reg view camera) for gpu visibility range culling if defined#24133kfc35 wants to merge 3 commits intobevyengine:mainfrom
Conversation
|
Just a learning question if you wouldn't mind: Why do directional light shadow views need to cull based on the camera's world position rather than the light's position? |
I don’t mind at all! As far as I understand, visibility ranges are only meant to define distances at which meshes start to fade out from view / fade into view when viewed from a user defined camera, as opposed to a shadow camera. This is specifically about visibility range culling as opposed to the more general frustum culling, even though the logic is in the same block in the wgsl file. In the specific example for |
|
@pcwalton just review requesting you since i think you might be most familiar with the things this code is touching / have strong opinions. please look whenever most convenient for you! |
Objective
Solution
ViewUniform, which will be used for visibility range culling.ViewUniformto ensure thatExtractedViewsfor entities that aren’t alsoExtractedCamerasand do not have auxiliary entities are not used for visibility range culling. SuchExtractedViewsshould only be Point and Spot lights.I actually do not know if this is the best way to send information to the gpu; I just tacked stuff onto
ViewUniform. If there is a different, more preferred way to do this work, you’ll have to give me some guidance as I’m not too experienced with rendering!NOTE: There’s also code that touches calculating the dithering level that I haven’t touched in the
wgsl. Let me know if that should be changed too….If anyone wants text on me explaining what the concrete changes are and why I did them, or just a different wording: https://discord.com/channels/691052431525675048/743663924229963868/1501630877082325062
Testing
cargo run --example visibility_range -- --no-cpu-cullingworks as desired without shadows popping in and outcargo run --example visibility_rangeworks as desired without shadows popping in and outcargo run --example spotlightandcargo run --example async_channel_patternfor regressions; they seem fine.